<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Fallback Example</title>
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="format-detection" content="telephone=no, email=no" />
  <script src="../loader.js"></script>
</head>

<body>
  <h1>Fibonacci Sequence</h1>
  <h3 id="summary"></h3>
  <div id="output"></div>

  <script>
    loadWebAssembly('./fib.wasm').then(instance => {
      const { fib } = instance.exports
      const result = []

      const beg = performance.now()
      for (let i = 0; i <= 35; ++i) {
        result[i] = fib(i)
      }
      const end = performance.now()

      summary.innerHTML += `${end - beg} ms`
      result.forEach((value, index) => {
        output.innerHTML += `<div>fib(${index}) = ${value}</div>`
      })
    })
  </script>
</body>
</html>
